============================================================================================================================
Modification Title: Portal System Addon: User Rank Icons Addon

Version: 1.0

Author: John Briggs

Last Updated: 08/20/10

Description: This modification will provide the ability to add the User Rank Icons modification with the portal just like on the index page.

Required: You must have the User Rank Icons Advanced v1.0 mod installed in order to use this portal addon.

Supported Version: XMB 1.9.5 SP1

Installation Note: Before adding this modification to your forum you should back up all files related to this modification.

License Note: This modification is released under the GPL License v3. A copy is provided with this software package.

Author Note:
For security purposes, Please Check: http://www.xmbgarage.com for the latest version of this modification.
Downloading this modification from other sites could cause malicious code to enter into your XMB Forum software.
As such, XMB Garage will not offer support for modifications not offered in our Request List.
============================================================================================================================
=======
Step 1:
=======
================
Edit File: portal.php
================
==========
Find Code:
==========

$whosonline = '';
if ($SETTINGS['whosonlinestatus'] == 'on') {
    $guestcount = $membercount = $hiddencount = 0;
    $member = array();

    $sql = $db->query("SELECT m.status, m.username, m.invisible, w.* FROM $table_whosonline w LEFT JOIN $table_members m ON m.username = w.username ORDER BY w.username");
    while ($online = $db->fetch_array($sql)) {
        switch ($online['username']) {
            case 'xguest123':
                $guestcount++;
                break;
            default:
                if ($online['invisible'] != 0 && X_ADMIN) {
                    $member[] = $online;
                    $hiddencount++;
                } elseif ($online['invisible'] != 0) {
                    $hiddencount++;
                } else {
                    $member[] = $online;
                    $membercount++;
                }
                break;
        }
    }
    $db->free_result($sql);

    $onlinetotal = $guestcount + $membercount;

    if ($membercount != 1) {
        $membern = '<strong>'.$membercount.'</strong> '.$lang['textmembers'];
    } else {
        $membern = '<strong>1</strong> '.$lang['textmem'];
    }

    if ($guestcount != 1) {
        $guestn = '<strong>'.$guestcount.'</strong> '.$lang['textguests'];
    } else {
        $guestn = '<strong>1</strong> '.$lang['textguest1'];
    }

    if ($hiddencount != 1) {
        $hiddenn = '<strong>'.$hiddencount.'</strong> '.$lang['texthmems'];
    } else {
        $hiddenn = '<strong>1</strong> '.$lang['texthmem'];
    }

    eval($lang['whosoneval']);
    $memonmsg = '<span class="smalltxt">'.$lang['whosonmsg'].'</span>';

    $memtally = array();
    $num = 1;
    $comma = '';
    $show_total = (X_ADMIN) ? ($membercount+$hiddencount) : ($membercount);

    $show_inv_key = false;
    for ($mnum = 0; $mnum < $show_total; $mnum++) {
        $pre = $suff = '';
        $online = $member[$mnum];
        switch ($online['status']) {
            case 'Super Administrator':
                $pre = '<strong><u><em>';
                $suff = '</em></u></strong>';
                break;
            case 'Administrator':
                $pre = '<strong><u>';
                $suff = '</u></strong>';
                break;
            case 'Super Moderator':
                $pre = '<em><strong>';
                $suff = '</strong></em>';
                break;
            case 'Moderator':
                $pre = '<strong>';
                $suff = '</strong>';
                break;
            default:
                $pre = '';
                $suff = '';
                break;
        }

        if ($online['invisible'] != 0) {
            $pre .= '<strike>';
            $suff = '</strike>'.$suff;
            if (!X_ADMIN && $online['username'] != $xmbuser) {
                $num++;
                continue;
            }
        }

        if ($online['username'] == $xmbuser && $online['invisible'] != 0) {
            $show_inv_key = true;
        }

        $memtally[] = '<a href="member.php?action=viewpro&amp;member='.rawurlencode($online['username']).'">'.$pre.''.$online['username'].''.$suff.'</a>';
        $num++;
    }

    if (X_ADMIN || $show_inv_key === true) {
        $hidden = ' - <strike>'.$lang['texthmem'].'</strike>';
    } else {
        $hidden = '';
    }

    $memtally = implode(', ', $memtally);

    if ($memtally == '') {
        $memtally = '&nbsp;';
    }

    $datecut = $onlinetime - (3600 * 24);
    if (X_ADMIN) {
        $sql = $db->query("SELECT username FROM $table_members WHERE lastvisit >= '$datecut' ORDER BY lastvisit DESC LIMIT 0, 50");
    } else {
        $sql = $db->query("SELECT username FROM $table_members WHERE lastvisit >= '$datecut' AND invisible != '1' ORDER BY lastvisit DESC LIMIT 0, 50");
    }

    $todaymembersnum = 0;
    $todaymembers = $comma = '';
    while ($memberstoday = $db->fetch_array($sql)) {
        $todaymembers .= $comma.' <a href="member.php?action=viewpro&amp;member='.rawurlencode($memberstoday['username']).'">'.$memberstoday['username'].'</a>';
        ++$todaymembersnum;
        $comma = ', ';
    }
    $db->free_result($sql);

    if ($todaymembersnum == 1) {
        $memontoday = $todaymembersnum.$lang['textmembertoday'];
    } else {
        $memontoday = $todaymembersnum.$lang['textmemberstoday'];
    }
    eval('$whosonline = "'.template('index_whosonline').'";');
}

==================
Replace Code With:
==================

$whosonline = '';
if ($SETTINGS['whosonlinestatus'] == 'on') {
    $guestcount = $membercount = $hiddencount = 0;
    $member = array();

    $sql = $db->query("SELECT m.status, m.username, m.invisible, w.* FROM $table_whosonline w LEFT JOIN $table_members m ON m.username = w.username ORDER BY w.username");
    while ($online = $db->fetch_array($sql)) {
        switch ($online['username']) {
            case 'xguest123':
                $guestcount++;
                break;
            default:
                if ($online['invisible'] != 0 && X_ADMIN) {
                    $member[] = $online;
                    $hiddencount++;
                } elseif ($online['invisible'] != 0) {
                    $hiddencount++;
                } else {
                    $member[] = $online;
                    $membercount++;
                }
                break;
        }
    }
    $db->free_result($query);

    $onlinetotal = $guestcount + $membercount;

    if ($membercount != 1) {
        $membern = '<strong>'.$membercount.'</strong> '.$lang['textmembers'];
    } else {
        $membern = '<strong>1</strong> '.$lang['textmem'];
    }

    if ($guestcount != 1) {
        $guestn = '<strong>'.$guestcount.'</strong> '.$lang['textguests'];
    } else {
        $guestn = '<strong>1</strong> '.$lang['textguest1'];
    }

    if ($hiddencount != 1) {
        $hiddenn = '<strong>'.$hiddencount.'</strong> '.$lang['texthmems'];
    } else {
        $hiddenn = '<strong>1</strong> '.$lang['texthmem'];
    }

    eval($lang['whosoneval']);
    $memonmsg = '<span class="smalltxt">'.$lang['whosonmsg'].'</span>';

    $memtally = array();
    $num = 1;
    $comma = '';
    $show_total = (X_ADMIN) ? ($membercount+$hiddencount) : ($membercount);

    $show_inv_key = false;
    for ($mnum = 0; $mnum < $show_total; $mnum++) {
        $pre = $suff = $ricon = '';
        $online = $member[$mnum];
        $pre = '<span class="status_'.str_replace(' ', '_', $online['status']).'">';
        $suff = '</span>';
        // User Rank Icons Advanced Mod End

        if ($online['invisible'] != 0) {
            $pre .= '<strike>';
            $suff = '</strike>'.$suff;
            if (!X_ADMIN && $online['username'] != $xmbuser) {
                $num++;
                continue;
            }
        }

        if ($online['username'] == $xmbuser && $online['invisible'] != 0) {
            $show_inv_key = true;
        }

        $memtally[] = "$ricon<a href=\"member.php?action=viewpro&amp;member=".rawurlencode($online['username'])."\">$pre$online[username]$suff</a>";
        $num++;
    }

    if (X_ADMIN || $show_inv_key === true) {
        $hidden = ' - <strike>'.$lang['texthmem'].'</strike>';
    } else {
        $hidden = '';
    }

    $memtally = implode(', ', $memtally);

    if ($memtally == '') {
        $memtally = '';
    }

    $datecut = $onlinetime - (3600 * 24);
    if (X_ADMIN) {
        $query = $db->query("SELECT username, status FROM $table_members WHERE lastvisit >= '$datecut' ORDER BY username ASC LIMIT 0, 50");
    } else {
        $query = $db->query("SELECT username, status FROM $table_members WHERE lastvisit >= '$datecut' AND invisible != '1' ORDER BY username ASC LIMIT 0, 50");
    }

    $todaymembersnum = 0;
    $todaymembers = $comma = $ricon = $pre = $suff = '';
    while ($memberstoday = $db->fetch_array($query)) {
        switch ($memberstoday['status']) {
            case 'Super Administrator':
                $ricon = '<img src="'.$THEME['imgdir'].'/online_supadmin.gif" border="0px" alt="'.$lang['ranksupadmin'].'" title="'.$lang['ranksupadmin'].'" />';
                $pre = '<em><strong><u>';
                $suff = '</u></strong></em>';
                break;
            case 'Administrator':
                $ricon = '<img src="'.$THEME['imgdir'].'/online_admin.gif" border="0px" alt="'.$lang['rankadmin'].'" title="'.$lang['rankadmin'].'" />';
                $pre = '<strong><u>';
                $suff = '</u></strong>';
                break;
            case 'Super Moderator':
                $ricon = '<img src="'.$THEME['imgdir'].'/online_supmod.gif" border="0px" alt="'.$lang['ranksupmod'].'" title="'.$lang['ranksupmod'].'" />';
                $pre = '<em><strong>';
                $suff = '</strong></em>';
                break;
            case 'Moderator':
                $ricon = '<img src="'.$THEME['imgdir'].'/online_mod.gif" border="0px" alt="'.$lang['rankmod'].'" title="'.$lang['rankmod'].'" />';
                $pre = '<strong>';
                $suff = '</strong>';
                break;
            default:
                $ricon = '<img src="'.$THEME['imgdir'].'/online_mem.gif" border="0px" alt="'.$lang['rankmem'].'" title="'.$lang['rankmem'].'" />';
                $pre = '';
                $suff = '';
                break;
        }
        $todaymembers .= "$comma $ricon<a href=\"member.php?action=viewpro&amp;member=".rawurlencode($memberstoday['username'])."\">$pre".$memberstoday['username']."$suff</a>";
        ++$todaymembersnum;
        $comma = ", ";
    }
    $db->free_result($query);

    if ($todaymembersnum == 1) {
        $memontoday = $todaymembersnum.$lang['textmembertoday'];
    } else {
        $memontoday = $todaymembersnum.$lang['textmemberstoday'];
    }

    $supadminkey = $adminkey = $supmodkey = $modkey = $memkey = '';
    $supadminkey = '<img src="'.$THEME['imgdir'].'/online_supadmin.gif" border="0px" alt="'.$lang['ranksupadmin'].'" title="'.$lang['ranksupadmin'].'" /><strong><u><em>'.$lang['superadmin'].'</em></u></strong> - ';
    $adminkey = '<img src="'.$THEME['imgdir'].'/online_admin.gif" border="0px" alt="'.$lang['rankadmin'].'" title="'.$lang['rankadmin'].'" /><strong><u>'.$lang['textsendadmin'].'</u></strong> - ';
    $supmodkey = '<img src="'.$THEME['imgdir'].'/online_supmod.gif" border="0px" alt="'.$lang['ranksupmod'].'" title="'.$lang['ranksupmod'].'" /><em><strong>'.$lang['textsendsupermod'].'</strong></em> - ';
    $modkey      = '<img src="'.$THEME['imgdir'].'/online_mod.gif\" border="0px" alt="'.$lang['rankmod'].'" title="'.$lang['rankmod'].'" /><strong>'.$lang['textsendmod'].'</strong> - ';
    $memkey = '<img src="'.$THEME['imgdir'].'/online_mem.gif" border="0px" alt="'.$lang['rankmem'].'" title="'.$lang['rankmem'].'" />'.$lang['textsendall'];

    eval('$whosonline = "'.template('index_whosonline').'";');
}
// User Rank Icons Advanced Mod End

=======================================================================================================================
Enjoy!